/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.openbrew.openbrewrf;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "Routes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Routes.findAll", query = "SELECT r FROM Routes r"),
    @NamedQuery(name = "Routes.findByRouteID", query = "SELECT r FROM Routes r WHERE r.routeID = :routeID"),
    @NamedQuery(name = "Routes.findByDayOfWeek", query = "SELECT r FROM Routes r WHERE r.dayOfWeek = :dayOfWeek"),
    @NamedQuery(name = "Routes.findByRouteDesc", query = "SELECT r FROM Routes r WHERE r.routeDesc = :routeDesc"),
    @NamedQuery(name = "Routes.findByRouteTime", query = "SELECT r FROM Routes r WHERE r.routeTime = :routeTime"),
    @NamedQuery(name = "Routes.findByRouteEndTime", query = "SELECT r FROM Routes r WHERE r.routeEndTime = :routeEndTime")})
public class Routes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "RouteID")
    private Integer routeID;
    /*@Basic(optional = false)
    @NotNull
    @Column(name = "RouteEmpID")
    private int routeEmpID;*/
    @Basic(optional = false)
    @NotNull
    @Column(name = "DayOfWeek")
    private int dayOfWeek;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 250)
    @Column(name = "RouteDesc")
    private String routeDesc;
    @Basic(optional = false)
    @NotNull
    @Column(name = "routeTime")
    @Temporal(TemporalType.TIME)
    private Date routeTime;
    @Basic(optional = false)
    @NotNull
    @Column(name = "routeEndTime")
    @Temporal(TemporalType.TIME)
    private Date routeEndTime;
    @JoinColumn(name = "RouteEmpID", referencedColumnName = "EmpID")
    @ManyToOne(optional = false)
    private Employee emp;
    @OneToMany(mappedBy = "custRouteID")
    private Collection<Customer> customerCollection;

    public Routes() {
    }

    public Routes(Integer routeID) {
        this.routeID = routeID;
    }

    public Routes(Integer routeID, int dayOfWeek, String routeDesc, Date routeTime, Date routeEndTime) {
        this.routeID = routeID;
        this.dayOfWeek = dayOfWeek;
        this.routeDesc = routeDesc;
        this.routeTime = routeTime;
        this.routeEndTime = routeEndTime;
    }

    public Integer getRouteID() {
        return routeID;
    }

    public void setRouteID(Integer routeID) {
        this.routeID = routeID;
    }

    /*public int getRouteEmpID() {
        return routeEmpID;
    }

    public void setRouteEmpID(int routeEmpID) {
        this.routeEmpID = routeEmpID;
    }*/

    public int getDayOfWeek() {
        return dayOfWeek;
    }

    public void setDayOfWeek(int dayOfWeek) {
        this.dayOfWeek = dayOfWeek;
    }

    public String getRouteDesc() {
        return routeDesc;
    }

    public void setRouteDesc(String routeDesc) {
        this.routeDesc = routeDesc;
    }

    public Date getRouteTime() {
        return routeTime;
    }

    public void setRouteTime(Date routeTime) {
        this.routeTime = routeTime;
    }

    public Date getRouteEndTime() {
        return routeEndTime;
    }

    public void setRouteEndTime(Date routeEndTime) {
        this.routeEndTime = routeEndTime;
    }

    public Employee getRouteEmpID() {
        return emp;
    }

    public void setRouteEmpID(Employee emp) {
        this.emp = emp;
    }

    @XmlTransient
    public Collection<Customer> getCustomerCollection() {
        return customerCollection;
    }

    public void setCustomerCollection(Collection<Customer> customerCollection) {
        this.customerCollection = customerCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (routeID != null ? routeID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Routes)) {
            return false;
        }
        Routes other = (Routes) object;
        if ((this.routeID == null && other.routeID != null) || (this.routeID != null && !this.routeID.equals(other.routeID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.Routes[ routeID=" + routeID + " ]";
    }
    
}
